import 'package:base/base_lib.dart';
import 'package:favorites/page/favorites_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:inbox/page/inbox_page.dart';
import 'package:more/page/more_page.dart';
import 'package:search/page/search_page.dart';
import 'package:trips/page/trips_page.dart';
import 'package:turo/res/lang.dart';

import '/res/images.dart';

//主页
class TabPage extends StatefulWidget {
  const TabPage({Key? key}) : super(key: key);

  @override
  _TabState createState() => _TabState();
}

class _TabState extends TabState<TabPage> with TickerProviderStateMixin {
  _TabState()
      : super(
            selectedItemColor: KColors.primaryColor,
            unselectedItemColor: KColors.c_333333,
            tabOptions: [
              TabOption(
                  children: SearchPage(),
                  navigationBarItem: BottomNavigationBarItem(
                      label: AppStrRes.search,
                      icon: AppImageRes.ic_search.assetRealImage(width: 26.w),
                      activeIcon: Stack(alignment: Alignment.center, children: [
                        AppImageRes.bottom_bar_background_oval.assetRealImage(
                            width: 26.w, color: KColors.primaryColor),
                        AppImageRes.ic_search.assetRealImage(
                            width: 26.w, color: KColors.primaryColor)
                      ])),
                  tabIndex: 0),
              TabOption(
                  children: FavoritesPage(),
                  navigationBarItem: BottomNavigationBarItem(
                      label: AppStrRes.favorites,
                      icon:
                          AppImageRes.ic_favorites.assetRealImage(width: 26.w),
                      activeIcon: Stack(alignment: Alignment.center, children: [
                        AppImageRes.bottom_bar_background_oval.assetRealImage(
                            width: 26.w, color: KColors.primaryColor),
                        AppImageRes.ic_favorites.assetRealImage(
                            width: 26.w, color: KColors.primaryColor)
                      ])),
                  tabIndex: 1),
              TabOption(
                  children: TripsPage(),
                  navigationBarItem: BottomNavigationBarItem(
                      label: AppStrRes.trips,
                      icon: AppImageRes.ic_trips.assetRealImage(width: 26.w),
                      activeIcon: Stack(alignment: Alignment.center, children: [
                        AppImageRes.bottom_bar_background_oval.assetRealImage(
                            width: 26.w, color: KColors.primaryColor),
                        AppImageRes.ic_trips.assetRealImage(
                            width: 26.w, color: KColors.primaryColor)
                      ])),
                  tabIndex: 2),
              TabOption(
                  children: InBoxPage(),
                  navigationBarItem: BottomNavigationBarItem(
                      label: AppStrRes.inbox,
                      icon: AppImageRes.ic_inbox.assetRealImage(width: 26.w),
                      activeIcon: Stack(alignment: Alignment.center, children: [
                        AppImageRes.bottom_bar_background_oval.assetRealImage(
                            width: 26.w, color: KColors.primaryColor),
                        AppImageRes.ic_inbox.assetRealImage(
                            width: 26.w, color: KColors.primaryColor)
                      ])),
                  tabIndex: 3),
              TabOption(
                  children: MorePage(),
                  navigationBarItem: BottomNavigationBarItem(
                      label: AppStrRes.more,
                      icon: AppImageRes.ic_more.assetRealImage(width: 26.w),
                      activeIcon: Stack(alignment: Alignment.center, children: [
                        AppImageRes.bottom_bar_background_oval.assetRealImage(
                            width: 26.w, color: KColors.primaryColor),
                        AppImageRes.ic_more.assetRealImage(
                            width: 26.w, color: KColors.primaryColor)
                      ])),
                  tabIndex: 4)
            ]);
}
